package main
import "fmt"

type base struct{
	num int
}
func (b base) describe() string {
	return fmt.Sprintf("base with num = %v", b.num)
}

type container struct{
	base
	str string
}


func main(){

	// 必须显示赋值
	c := container{
		base:base{1},
		str:"hahaha",
	}
	fmt.Println("container c :",c)

	fmt.Printf("c.num:%v; c.str:%v \n",c.num,c.str)
	fmt.Println("c.num:",c.base.num)

	// 可以直接调用嵌入的方法
	fmt.Println("des:",c.describe())
	fmt.Println("des:",c.base.describe())


	type describer interface{
		describe() string
	}

	var d describer = c
	fmt.Println("describer d :",d)
	fmt.Println("d describe :",d.describe())

	c.num = 2
	fmt.Println("d describe :",d.describe())
	fmt.Println("c describe :",c.describe())
	
}